#!/bin/bash
echo hooks/build hook works!
echo IMAGE_NAME: $IMAGE_NAME
if [ "${DOCKER_TAG}" = latest -o "${DOCKER_TAG}" = vncless ]
then
	EC_VER=7.6.3
else
	EC_VER="$( echo "${DOCKER_TAG}" | sed -E 's/^(latest|vncless)-//' )"
fi
docker build --cache-from $IMAGE_NAME --build-arg BUILDKIT_INLINE_CACHE=1 --build-arg EC_URL="$(cat "ec_urls/${EC_VER}.txt")"  -f $DOCKERFILE_PATH -t $IMAGE_NAME .
